<%@ include file="/taglibs.jsp"%>
<%@ page import ="java.util.*" %>
<%@ page import = "com.pay.sms.model.MessageFile" %>
<%@ page import = "com.pay.sms.model.User" %>
<%
	User user = (User)request.getAttribute("user");
	Map map = user.getWhitePhone(user); 
%>

<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="${js}/jquery-1.6.min.js" type="text/javascript"></script>
<script src="${js}/jquery.validate.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" media="screen" href="${css}/screen.css" />
<title></title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.STYLE1 {font-size: 12px}
.STYLE4 {
	font-size: 12px;
	color: #1F4A65;
	font-weight: bold;
}

a:link {
	font-size: 12px;
	color: #06482a;
	text-decoration: none;

}
a:visited {
	font-size: 12px;
	color: #06482a;
	text-decoration: none;
}
a:hover {
	font-size: 12px;
	color: #FF0000;
	text-decoration: underline;
}
a:active {
	font-size: 12px;
	color: #FF0000;
	text-decoration: none;
}
.STYLE7 {font-size: 12}

-->
</style>

<script type="text/javascript">
	function selEle(){
		var t = document.getElementsByName("shouldSend");
		var destObj = document.getElementById("selall");
		for(var m =0 ;m <t.length;m++){
			t[m].checked = destObj.checked;
		}
	}
	
	function sendmessage()
	{
		var sendnums="";
		var nosendnums="";
		
		var t = document.getElementsByName("shouldSend");
		for(var m =0 ;m <t.length;m++){
			if(t[m].checked == true){
				sendnums = sendnums+t[m].value+",";
			}else{
				nosendnums = nosendnums+t[m].value+",";
			}
		}
		//sendnums = sendnums.substr(0,sendnums.length-1);
		//nosendnums = nosendnums.substr(0,nosendnums.length-1);
		document.getElementById("needsend").value=sendnums;
		document.getElementById("notsend").value=nosendnums;
		
		var id = document.getElementById("id").value;
		var url = "${ctx}/put/needsend";
		if(id != "-1"){
			url = url+"?id="+id;
		}
		$('#sms-fms').attr('action',url);
		$('#sms-fms').submit();
	}
	
</script>
</head>
<body>
<form id="sms-fms" method="post" class="cmxform">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="15" height="30"><img src="${img}/tab_03.gif" width="15" height="30" /></td>
        <td width="1101" background="${img}/tab_05.gif"><img src="${img}/311.gif" width="16" height="16" /> <span class="STYLE4">号码查看</span></td>
        <td width="14"><img src="${img}/tab_07.gif" width="14" height="30" /></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="9" background="${img}/tab_12.gif">&nbsp;</td>
        <td ><table width="99%" border="0" align="center" cellpadding="0" cellspacing="1"  border="1">
          <tr>
            <td width="10%">信息内容：</td>
            <td width="90%" style="word-wrap: break-word;word-break:break-all;">
            ${entity.message} 
            </td>
          </tr>
          <tr><td height="10px"></td><td></td></tr>
          <tr>
            <td width="10%"><input name="id" id="id" type="hidden" value="${entity.id}" /><input name="userId" id="userId" type="hidden" value="${entity.userId}" />发送号码：</td>
            <td width="90%" style="word-wrap: break-word;word-break:break-all;">
            ${entity.files} 
            </td>
          </tr>
          <tr><td height="10px"></td><td></td></tr>
          <tr>
            <td ><input name="id" id="id" type="hidden" value="${entity.id}" />扣量选择：

            <input name="needsend" id="needsend" type="hidden" value="" />
            <input name="notsend" id="notsend" type="hidden" value="" />
            </td>
            <td style="word-wrap: break-word;word-break:break-all;" align="left">
             <%
             	String[] nums = ((MessageFile)request.getAttribute("entity")).getFiles().split(",");
             	for(int i = 1; i<=nums.length;i++){
             	%>
             	 <input type="checkbox" name="shouldSend" value="<%=nums[i-1] %>" style="border:0px"><%if(map.containsKey(nums[i-1])){%><font color="red"><%=nums[i-1] %></font><%}else{%><%=nums[i-1] %><%} %>
             	 
             	<%
             		if (i%10 == 0)out.println("<br/>");
             	}
             %>
            </td>
          </tr> 
          <tr height="30px" align="left"><td height="30px"></td>
          <td style="color: red">
          <input type="checkbox" id="selall" value="1" style="border:0px" onclick="selEle()"/>全选 <br/>
          * 注意事项如下：<br/>
          <font color="red"><B>1.请勾选需要发送的号码&nbsp;&nbsp;<br/>
          2.如果全部不选表示全部扣量<br/>
          3.红色号码为白名单号码，请注意勾选</B></font>
          
          </td></tr> 
        </table></td>
        <td width="9" background="${img}/tab_16.gif">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="29"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="15" height="29"><img src="${img}/tab_20.gif" width="15" height="29" /></td>
        <td background="${img}/tab_21.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="100%" valign="top" class="STYLE1" align="center">
             <input type="button" name="save" value="发送" onclick="sendmessage();">
             <input type="button" name="save" value="返回" onclick="javascript:history.go(-1);">
            </td>
          </tr>
        </table></td>
        <td width="14"><img src="${img}/tab_22.gif" width="14" height="29" /></td>
      </tr>
    </table></td>
  </tr>
</table>
</form>
</body>
</html>